class AddReferencesToNewsOfferedMaterials < ActiveRecord::Migration
  def self.up

    remove_column  :news_offered_materials, :reference_id
    remove_column  :news_offered_materials, :reference_type

    add_column  :news_offered_materials, :customer_reference_id, :integer
    add_column  :news_offered_materials, :customer_reference_type, :string

    add_column  :news_offered_materials, :news_reference_id, :integer
    add_column  :news_offered_materials, :news_reference_type, :string

    add_column  :news_offered_materials, :contact_id, :integer
  end

  def self.down
    add_column  :news_offered_materials, :reference_id, :integer
    add_column  :news_offered_materials, :reference_type, :string

    remove_column  :news_offered_materials, :news_reference_id
    remove_column  :news_offered_materials, :news_reference_type

    remove_column  :news_offered_materials, :customer_reference_id
    remove_column  :news_offered_materials, :customer_reference_type

    remove_column  :news_offered_materials, :contact_id
  end
end

